package main;

import java.io.File;
import java.util.List;

import utils.BlockUtils;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if(args.length != 2) {
			System.out.println("This command needs 2 args");
			System.exit(0);
		}
		String root = args[0];
		String dest = args[1];
		root = BlockUtils.prepareRoot(root);
		dest = BlockUtils.prepareDest(dest, root);
		//В начале итерации мы находимся в корне
		File f = BlockUtils.checkDestFile(root, dest);
		if(f == null)
			System.exit(1);
		List<File> listFiles = BlockUtils.getListFiles(f, root);
		if(listFiles.isEmpty())
			System.out.println("Catalogue is empty");
		else
			for(File files : listFiles) {
				System.out.println(BlockUtils.getFileInfo(files));
			}
	}
}
